home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / dskhrdldr.lha / FileRunner.s < prev    next >
Encoding:
Text File  |  1980-01-12  |  4.2 KB  |  274 lines

  1. ; This example shows how to use the file loader segment, just give it a
  2. ; filename string, drive number, data pointer and mfm buffer and it'll
  3. ; load it to your data point...
  4. ;
  5. ; NOTE: this routine cannot handle directories yet!!! (i'll have it sorted)
  6. ; (top one.)  so just keep everything on a disk, besides, directories take
  7. ; up sector space!!   oh, and it only recognises old file sys, i'll have
  8. ; fastfilesys sorted 4 all you 2.0 owners.. (more disk-space and less
  9. ; fucking about..)
  10.  
  11. ; a retro corporation product,   updated 21-5-93 to nuDtrakker by spillage..
  12.  
  13.     Opt    c-
  14.     Section    "Base Code",Code_c
  15.     
  16.     IncDir    Df1:
  17.  
  18. Start    Movem.l    d0-d7/a0-a6,-(sp) 
  19.     Bsr    KillSys
  20.     Move.w    #$83c0,$Dff096
  21.  
  22.     Lea    FileName(pc),a0
  23.     Lea    $e0000,a1    ; Data Pointer
  24.     Lea    $f0000,a2    ; MFM Pointer
  25.     Moveq    #1,d0    ; Drive 1    
  26.     Bsr    FileLoad+$20    ; Load File    
  27.     
  28. XX    Btst    #6,$Bfe001
  29.     Bne    XX
  30.  
  31. Quit    Bsr    ReturnSys
  32.     Movem.l    (sp)+,d0-d7/a0-a6 
  33.     Moveq    #0,d0      
  34.     Rts
  35.  
  36. VBL    Move.l    $Dff004,d0
  37.     And.l    #$1ff00,d0
  38.     Cmp.l    #$13000,d0
  39.     Bne    VBL
  40.     Rts
  41.  
  42. KillSys    Bsr.s    SysWait    
  43.  
  44.     Move.l    $4,a6    
  45.     Lea    GFXName(pc),a1    
  46.     Moveq    #0,d0    
  47.     Jsr    -552(a6)    
  48.         
  49.     Lea    OldCop1(pc),a5
  50.     Move.l    $26(a0),$0(a5)    
  51.     Move.l    $32(a0),$4(a5)    
  52.     
  53.     Lea    HardWare,a6
  54.     Move.w    IntEnaR(a6),d0    
  55.     Move.w    DMAConR(a6),d1  
  56.     Or.w    #$8000,d0    
  57.     And.w    #$03ff,d1    
  58.     Or.w    #$8000,d1    
  59.     Move.w    d0,$8(a5)    
  60.     Move.w    d1,$a(a5)    
  61.     
  62.     Move.w    #$7fff,IntEna(a6) 
  63.     Move.w    #$7fff,DMACon(a6) 
  64.     Rts
  65.  
  66. SysWait    Move.w    #15,d7    
  67. SysWaitLoop    Move.l    #$05000,d1    
  68.     Bsr.s    WaitVBL    
  69.     Bsr.s    DoWaitVBL    
  70.     Dbf    d7,SysWaitLoop    
  71.     Rts
  72.  
  73. DoWaitVBL    Move.l    #$03000,d1    
  74. WaitVBL    Movem.l    d0-d1/a6,-(sp)    
  75.     Lea    HardWare,a6    
  76. WaitVBLLoop    Move.l    VPosR(a6),d0    
  77.     And.l    #$1ff00,d0    
  78.     Cmp.l    d1,d0    
  79.     Bne.s    WaitVBLLoop    
  80.     Movem.l    (sp)+,d0-d1/a6    
  81.     Rts        
  82.  
  83. ReturnSys    Lea    HardWare,a6    
  84.     Move.w    OldIntEna(pc),IntEna(a6)
  85.     Move.w    OldDMACon(pc),DMACon(a6)
  86.     Move.l    OldCop1(pc),Cop1lc(a6)
  87.     Move.l    OldCop2(pc),Cop2lc(a6)
  88.     Rts
  89.  
  90. GFXName    Dc.b    "graphics.library",0
  91.     Even
  92. OldCop1    Dc.l    0    
  93. OldCop2    Dc.l    0    
  94. OldIntEna    Dc.w    0    
  95. OldDmaCon    Dc.w    0    
  96. Screen    Dc.l    $c0000    
  97.  
  98. FileName    Dc.b    "grilling_birds.txt",0
  99.     Even
  100.  
  101. Cmv    Macro
  102.     Dc.w    \2,\1
  103.     EndM
  104.     
  105. Cwt    Macro
  106.     Dc.w    (\1*$100)+$01,$fffe
  107.     EndM    
  108.  
  109. Pal    Macro
  110.     Dc.w    $ffe1,$fffe
  111.     EndM    
  112.  
  113. EndCop    Macro
  114.     Dc.w    $ffff,$fffe
  115.     EndM    
  116.  
  117. CopperList    Cwt    $15    
  118.     Cmv    $0200,BplCon0    
  119.     Cmv    $00bb,BplCon1    
  120.     Cmv    $000a,BplCon2    
  121.     Cmv    $0034,DdfStrt    
  122.     Cmv    $00c8,DdfStop    
  123.     Cmv    $1681,DiwStrt    
  124.     Cmv    $36c1,DiwStop
  125.     Cmv    $0,BplMod1    
  126.     Cmv    $0,BplMod2    
  127.     
  128.     Cwt    $25        
  129.     Cmv    $0000,Color00    
  130.     Cmv    $0fff,Color01
  131.     
  132. CopperBPLS    Cmv    $e,BplPt0h    
  133.     Cmv    $0,BplPt0l    
  134.     Cmv    $0,BplPt1h    
  135.     Cmv    $0,BplPt1l    
  136.     Cmv    $0,BplPt2h    
  137.     Cmv    $0,BplPt2l    
  138.     Cmv    $0,BplPt3h    
  139.     Cmv    $0,BplPt3l    
  140.     Cmv    $0,BplPt4h
  141.     Cmv    $0,BplPt4l 
  142.     
  143.     Cwt    $28    
  144.     Cmv    $1200,BplCon0    
  145.  
  146.     EndCop
  147.  
  148. FileLoad    Incbin    MyMateMarmite/FileLoader-Seg
  149.  
  150. ****Custom Chip Registers****
  151.  
  152. Hardware    = $Dff000
  153.  
  154. ;Control Registers
  155.  
  156. Dmaconr    = $002
  157. Vposr    = $004
  158. Vhposr    = $006
  159. Joy0dat    = $00A
  160. Joy1dat    = $00C
  161. Clxdat    = $00E
  162. Intenar    = $01C
  163. Intereqr    = $01E
  164. Copcon    = $02E
  165.  
  166. ;Blitter Registers
  167.  
  168. Bltcon0    = $040
  169. Bltcon1    = $042
  170. Bltafwm    = $044
  171. Bltalwm    = $046
  172. Bltcpth    = $048
  173. Bltcptl    = $04A
  174. Bltbpth    = $04C
  175. Bltbptl    = $04E
  176. Bltapth    = $050
  177. Bltaptl    = $052
  178. Bltdpth    = $054
  179. Bltdptl    = $056
  180. Bltsize    = $058
  181. Bltcmod    = $060
  182. Bltbmod    = $062
  183. Bltamod    = $064
  184. Bltdmod    = $066
  185. Bltcdat    = $070
  186. Bltbdat    = $072
  187. Bltadat    = $074
  188.  
  189. ;Copper Registers
  190.  
  191. Cop1lc    = $080
  192. Cop1lch    = $080
  193. Cop1lcl    = $082
  194. Cop2lc    = $084
  195. Cop2lch    = $084
  196. Cop2lcl    = $086
  197. Copjmp1    = $088
  198. Copjmp2    = $08A
  199. Diwstrt    = $08E
  200. Diwstop    = $090
  201. Ddfstrt    = $092
  202. Ddfstop    = $094
  203. Dmacon    = $096
  204. Clxcon    = $098
  205. Intena    = $09A
  206. Intreq    = $09C
  207.  
  208. ;BitPlane Registers 
  209.  
  210. BplCon0    = $100
  211. BplCon1    = $102
  212. BplCon2    = $104
  213. BplMod1    = $108
  214. BplMod2    = $10a
  215.  
  216. BplPt0h    = $0e0
  217. BplPt0l    = $0e2
  218. BplPt1h    = $0e4
  219. BplPt1l    = $0e6
  220. BplPt2h    = $0e8
  221. BplPt2l    = $0ea
  222. BplPt3h    = $0ec
  223. BplPt3l    = $0ee
  224. BplPt4h    = $0f0
  225. BplPt4l    = $0f2
  226. BplPt5h    = $0f4
  227. BplPt5l    = $0f6
  228.  
  229. ;Colour Registers
  230.  
  231. Color00    = $180
  232. Color01    = $182
  233. Color02    = $184
  234. Color03    = $186
  235. Color04    = $188
  236. Color05    = $18a
  237. Color06    = $18c
  238. Color07    = $18e
  239. Color08    = $190
  240. Color09    = $192
  241. Color10    = $194
  242. Color11    = $196
  243. Color12    = $198
  244. Color13     = $19a
  245. Color14     = $19c
  246. Color15     = $19e
  247. Color16     = $1a0
  248. Color17     = $1a2
  249. Color18     = $1a4
  250. Color19     = $1a6
  251. Color20     = $1a8
  252. Color21     = $1aa
  253. Color22     = $1ac
  254. Color23     = $1ae
  255. Color24     = $1b0
  256. Color25     = $1b2
  257. Color26     = $1b4
  258. Color27     = $1b6
  259. Color28     = $1b8
  260. Color29     = $1ba
  261. Color30     = $1bc
  262. Color31     = $1be
  263.  
  264. EcsNop    = $1fe
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.